#define BSZ 24
group { name: "elm/player/base/default";
   script {
      public in_control;
      public in_volume;
      public inside;

      public eval_in() {
         new v1 = get_int(in_control);
         new v2 = get_int(in_volume);
         new isin = get_int(inside);

         if (isin) {
            if ((!v1) && (!v2)) {
               emit("conhide", "");
               set_int(inside, 0);
            }
         } else {
            if ((v1) || (v2)) {
               emit("conshow", "");
               set_int(inside, 1);
            }
         }
      }
   }
   parts {
      part { name: "bg"; type: RECT;
         description { state: "default" 0.0;
            color: 0 0 0 255; // no cc
         }
      }
      part { name: "clipper"; type: RECT;
         description { state: "default" 0.0;
            rel.to: "bg";
         }
      }
      // video (elm_video) content here
      part { name: "elm.swallow.content"; type: SWALLOW;
         clip_to: "clipper";
         description { state: "default" 0.0;
         }
      }

      part { name: "bar";  type: RECT;
         clip_to: "clipper";
         scale: 1;
         description { state: "default" 0.0;
            rel1.offset: 0 -6;
            rel1.to_y: "elm.swallow.media_player.prev";
            rel2.to_y: "elm.swallow.media_player.positionslider";
            rel2.offset: -1 4;
            color_class: "/bg/normal/player/bar";
            offscale;
         }
      }

      part { name: "volclip"; type: RECT;
         description { state: "default" 0.0;
            rel1.to: "bg";
            color: 255 255 255 0; // no cc
            visible: 0;
         }
         description { state: "visible" 0.0;
            inherit: "default" 0.0;
            color: 255 255 255 255; // no cc
            visible: 1;
         }
      }
      part { name: "volpop"; type: RECT;
         clip_to: "volclip";
         description { state: "default" 0.0;
            rel1.to: "elm.swallow.media_player.volumeslider";
            rel1.offset: -1 -1;
            rel2.to: "elm.swallow.media_player.volumeslider";
            rel2.offset: 0 0;
            color_class: "/bg/normal/player/bar";
         }
      }

      part { name: "elm.swallow.media_player.prev"; type: SWALLOW; 
         clip_to: "clipper";
         scale: 1;
         description { state: "default" 0.0;
            fixed: 1 1;
            min: BSZ BSZ;
            align: 0.0 0.0;
            rel1.relative: 0.0 1.0;
            rel1.offset: 5 5;
            rel2.relative: 0.0 1.0;
            rel2.offset: 5 5;
            offscale;
         }
         description { state: "visible" 0.0;
            inherit: "default" 0.0;
            rel1.offset: 5 -6;
            rel2.offset: 5 -6;
            align: 0.0 1.0;
         }
      }
      part { name: "elm.swallow.media_player.rewind"; type: SWALLOW; 
         clip_to: "clipper";
         scale: 1;
         description { state: "default" 0.0;
            fixed: 1 1;
            min: BSZ BSZ;
            align: 0.0 1.0;
            rel1.to: "elm.swallow.media_player.prev";
            rel1.relative: 1.0 0.0;
            rel1.offset: 5 0;
            rel2.to: "elm.swallow.media_player.prev";
            rel2.relative: 1.0 1.0;
            rel2.offset: 5 -1;
            offscale;
         }
      }
      part { name: "elm.swallow.media_player.play"; type: SWALLOW; 
         clip_to: "clipper";
         scale: 1;
         description { state: "default" 0.0;
            fixed: 1 1;
            min: BSZ BSZ;
            align: 0.0 1.0;
            rel1.to: "elm.swallow.media_player.rewind";
            rel1.relative: 1.0 0.0;
            rel1.offset: 5 0;
            rel2.to: "elm.swallow.media_player.rewind";
            rel2.relative: 1.0 1.0;
            rel2.offset: 5 -1;
            offscale;
         }
         description { state: "hidden" 0.0;
            inherit: "default" 0.0;
            visible: 0;
         }
      }
      part { name: "elm.swallow.media_player.pause"; type: SWALLOW; 
         clip_to: "clipper";
         scale: 1;
         description { state: "default" 0.0;
            fixed: 1 1;
            min: BSZ BSZ;
            rel1.to: "elm.swallow.media_player.play";
            rel2.to: "elm.swallow.media_player.play";
         }
         description { state: "hidden" 0.0;
            inherit: "default" 0.0;
            visible: 0;
         }
      }
      part { name: "elm.swallow.media_player.forward"; type: SWALLOW; 
         clip_to: "clipper";
         scale: 1;
         description { state: "default" 0.0;
            fixed: 1 1;
            min: BSZ BSZ;
            align: 0.0 1.0;
            rel1.to: "elm.swallow.media_player.play";
            rel1.relative: 1.0 0.0;
            rel1.offset: 5 0;
            rel2.to: "elm.swallow.media_player.play";
            rel2.relative: 1.0 1.0;
            rel2.offset: 5 -1;
            offscale;
         }
      }
      part { name: "elm.swallow.media_player.next"; type: SWALLOW; 
         clip_to: "clipper";
         scale: 1;
         description { state: "default" 0.0;
            fixed: 1 1;
            min: BSZ BSZ;
            align: 0.0 1.0;
            rel1.to: "elm.swallow.media_player.forward";
            rel1.relative: 1.0 0.0;
            rel1.offset: 5 0;
            rel2.to: "elm.swallow.media_player.forward";
            rel2.relative: 1.0 1.0;
            rel2.offset: 5 -1;
            offscale;
         }
      }
      part { name: "elm.swallow.media_player.stop"; type: SWALLOW;
         clip_to: "clipper";
         scale: 1;
         description { state: "default" 0.0;
            fixed: 1 1;
            min: BSZ BSZ;
            align: 0.0 1.0;
            rel1.to: "elm.swallow.media_player.next";
            rel1.relative: 1.0 0.0;
            rel1.offset: 5 0;
            rel2.to: "elm.swallow.media_player.next";
            rel2.relative: 1.0 1.0;
            rel2.offset: 5 -1;
            offscale;
         }
      }
      part { name: "elm.swallow.media_player.eject"; type: SWALLOW;
         clip_to: "clipper";
         scale: 1;
         description { state: "default" 0.0;
            fixed: 1 1;
            min: BSZ BSZ;
            align: 0.0 1.0;
            rel1.to: "elm.swallow.media_player.stop";
            rel1.relative: 1.0 0.0;
            rel1.offset: 5 0;
            rel2.to: "elm.swallow.media_player.stop";
            rel2.relative: 1.0 1.0;
            rel2.offset: 5 -1;
            offscale;
         }
      }
      part { name: "elm.swallow.media_player.volume"; type: SWALLOW;
         clip_to: "clipper";
         scale: 1;
         description { state: "default" 0.0;
            fixed: 1 1;
            min: BSZ BSZ;
            align: 0.0 1.0;
            rel1.to: "elm.swallow.media_player.eject";
            rel1.relative: 1.0 0.0;
            rel1.offset: 5 0;
            rel2.to: "elm.swallow.media_player.eject";
            rel2.relative: 1.0 1.0;
            rel2.offset: 5 -1;
            offscale;
         }
         description { state: "hidden" 0.0;
            inherit: "default" 0.0;
            visible: 0;
         }
      }
      part { name: "elm.swallow.media_player.mute"; type: SWALLOW; 
         clip_to: "clipper";
         scale: 1;
         description { state: "default" 0.0;
            fixed: 1 1;
            min: BSZ BSZ;
            rel1.to: "elm.swallow.media_player.volume";
            rel2.to: "elm.swallow.media_player.volume";
         }
         description { state: "hidden" 0.0;
            inherit: "default" 0.0;
            visible: 0;
         }
      }
      part { name: "elm.swallow.media_player.info"; type: SWALLOW; 
         clip_to: "clipper";
         scale: 1;
         description { state: "default" 0.0;
            fixed: 1 1;
            min: BSZ BSZ;
            align: 0.0 1.0;
            rel1.to: "elm.swallow.media_player.volume";
            rel1.relative: 1.0 0.0;
            rel1.offset: 5 0;
            rel2.to: "elm.swallow.media_player.volume";
            rel2.relative: 1.0 1.0;
            rel2.offset: 5 -1;
            offscale;
         }
      }
      part { name: "elm.swallow.media_player.positionslider"; type: SWALLOW; 
         clip_to: "clipper";
         scale: 1;
         description { state: "default" 0.0;
            fixed: 0 1;
            rel1.relative: 1.0 0.0;
            rel1.offset: 5 0;
            rel1.to: "elm.swallow.media_player.info";
            rel2.to_y: "elm.swallow.media_player.info";
            rel2.offset: -6 -1;
            offscale;
         }
      }
     part { name: "elm.swallow.media_player.volumeslider"; type: SWALLOW;
         clip_to: "volclip";
         scale: 1;
         description { state: "default" 0.0;
            fixed: 1 1;
            rel1.to_x: "elm.swallow.media_player.volume";
            rel1.offset: 0 1;
            rel2.to: "elm.swallow.media_player.volume";
            rel2.offset: -1 -3;
            rel2.relative: 1.0 0.0;
            align: 0.5 1.0;
            max: 99999 100;
         }
      }

      part { name: "controls"; type: RECT; repeat_events: 1;
         clip_to: "clipper";
         scale: 1;
         description { state: "default" 0.0;
            min: BSZ BSZ;
            align: 0.5 1.0;
            rel1.relative: 0.0 0.8;
            color: 0 0 0 0; // no cc
         }
      }

      part { name: "volumetop"; type: SPACER;
         description { state: "default" 0.0;
            fixed: 1 1;
            rel1.to_y: "elm.swallow.media_player.volumeslider";
            rel1.relative: 0.0 0.0;
            rel2.to_y: "controls";
            rel2.relative: 1.0 0.0;
            align: 0.5 0.0;
         }
      }
      part { name: "volume"; type: RECT; repeat_events: 1;
         clip_to: "clipper";
         description { state: "default" 0.0;
            fixed: 1 1;
            rel1.to_y: "volumetop";
            rel1.to_x: "elm.swallow.media_player.volume";
            rel1.relative: -1.0 0.0;
            rel1.offset: 0 -20;
            rel2.to: "elm.swallow.media_player.volume";
            rel2.relative: 2.0 1.0;
            align: 0.5 1.0;
            color: 0 0 0 0; // no cc
            visible: 0;
         }
         description { state: "visible" 0.0;
            inherit: "default" 0.0;
            visible: 1;
         }
      }
   }
   programs {
      program { name: "ci";
         signal: "mouse,in"; source: "controls";
         script {
            set_int(in_control, 1);
            eval_in();
         }
      }
      program { name: "co";
         signal: "mouse,out"; source: "controls";
         script {
            set_int(in_control, 0);
            eval_in();
         }
      }
      program { name: "vi";
         signal: "mouse,in"; source: "volume";
         script {
            set_int(in_volume, 1);
            eval_in();
         }
      }
      program { name: "vo";
         signal: "mouse,out"; source: "volume";
         script {
            set_int(in_volume, 0);
            eval_in();
         }
      }
      program {
         signal: "conshow"; source: "";
         action: STATE_SET "visible" 0.0;
         transition: DECELERATE 0.2;
         target: "elm.swallow.media_player.prev";
         target: "volume";
      }
      program {
         signal: "conhide"; source: "";
         action: STATE_SET "default" 0.0;
         transition: ACCELERATE 0.5;
         target: "elm.swallow.media_player.prev";
         target: "volume";
      }
      program {
         signal: "mouse,in"; source: "volume";
         action: STATE_SET "visible" 0.0;
         transition: DECELERATE 0.5;
         target: "volclip";
      }
      program {
         signal: "mouse,out"; source: "volume";
         action: STATE_SET "default" 0.0;
         transition: ACCELERATE 0.5;
         target: "volclip";
      }

      program {
         signal: "load"; source: "";
         after: "pause/0";
      }
      program {
         signal: "elm,player,play"; source: "elm";
         after: "play/0";
      }
      program {
         signal: "elm,player,pause"; source: "elm";
         after: "pause/0";
      }
      program { name: "play/0";
         action: STATE_SET "hidden" 0.0;
         target: "elm.swallow.media_player.play";
         after: "play/1";
      }
      program { name: "play/1";
         action: STATE_SET "default" 0.0;
         target: "elm.swallow.media_player.pause";
      }
      program { name: "pause/0";
         action: STATE_SET "hidden" 0.0;
         target: "elm.swallow.media_player.pause";
         after: "pause/1";
      }
      program { name: "pause/1";
         action: STATE_SET "default" 0.0;
         target: "elm.swallow.media_player.play";
      }

      program {
         signal: "load"; source: "";
         after: "unmute/0";
      }
      program {
         signal: "elm,player,mute"; source: "elm";
         after: "mute/0";
      }
      program {
         signal: "elm,player,unmute"; source: "elm";
         after: "unmute/0";
      }
      program { name: "mute/0";
         action: STATE_SET "hidden" 0.0;
         target: "elm.swallow.media_player.volume";
         after: "mute/1";
      }
      program { name: "mute/1";
         action: STATE_SET "default" 0.0;
         target: "elm.swallow.media_player.mute";
      }
      program { name: "unmute/0";
         action: STATE_SET "hidden" 0.0;
         target: "elm.swallow.media_player.mute";
         after: "unmute/1";
      }
      program { name: "unmute/1";
         action: STATE_SET "default" 0.0;
         target: "elm.swallow.media_player.volume";
      }
      
   }
}

group { name: "elm/player/base/flush";
   inherit: "elm/player/base/default";
   parts {
      part { name: "bg";
         description { state: "default" 0.0;
            rel1.offset: 0 0;
            rel2.offset: -1 -1;
         }
      }
      part { name: "elm.swallow.content";
         description { state: "default" 0.0;
            rel1.offset: 0 0;
            rel2.offset: -1 -1;
         }
      }
      part { name: "bar";
         description { state: "default" 0.0;
            rel1.offset: 0 0;
            rel2.offset: -1 -1;
         }
      }
      part { name: "elm.swallow.media_player.prev";
         description { state: "default" 0.0;
            rel1.offset: 0 7;
            rel2.offset: 0 7;
         }
         description { state: "visible" 0.0;
            rel1.offset: 0 -1;
            rel2.offset: 0 -1;
         }
      }
      part { name: "elm.swallow.media_player.positionslider";
         description { state: "default" 0.0;
            rel2.offset: -1 -1;
         }
      }
   }
}
